<?php $this->load->view('common/ck-bosspagehead'); ?>
<?php $this->load->view('common/ck-bossheader'); ?>
<article id="content">
    <div class="pgwrapper">
    <div class="w960 bg1 p15 bx_shw">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="20%" style="border-right: 2px solid #e5e5e5;" valign="top">
			<?php $this->load->view('enterprises/leftnavCMS'); ?>
			</td>
			<td width="80%" valign="top"><form enctype="multipart/form-data"
					action="/addStore" onsubmit="return validateForm()" method="POST">
					<table width="100%" border="0" cellpadding="5" cellspacing="0"
						style="padding-left: 20px;">
						<tr>
						<td class="txt-blck">Select Category:</td>
						 <td><select id="store_category_tbl_id[]" multiple="multiple" style="width: 200px;" name="store_category_tbl_id[]">
			                	<?php foreach ($allCategoriesArray as $temp){ ?>
								<option value="<?php echo $temp['category_id']; ?>">
								<?php echo $temp['category_name']; ?>
								</option>
								<?php } ?>		                	
			            	</select></td>
						</tr>
						<tr>
						<td class="txt-blck">Relevant Category:</td>
						 <td><select id="relevant_category_id" style="width: 200px;" name="relevant_category_id">
						 		<option value="0">Select</option>
			                	<?php foreach ($allCategoriesArray as $temp){ ?>
								<option value="<?php echo $temp['category_id']; ?>">
								<?php echo $temp['category_name']; ?>
								</option>
								<?php } ?>		                	
			            	</select></td>
						</tr>
						<tr>
							<td class="txt-blck" width="30%">Store Name:</td>
							<td width="70%"><input type="text" onblur="makeURLStore(this)" value="" name="store_name"
								id="store_name" class="inputCMS" style="width: 300px;" />
							</td>
						</tr>
						<tr>
							<td class="txt-blck" width="30%">Store Url:</td>
							<td width="70%"><input type="text" value="" name="store_url"
								id="store_url" class="inputCMS" style="width: 300px;" />
							</td>
						</tr>
							<tr>
						<td class="txt-blck">Store Image:</td>
						<td><input type="file" id="store_image" name="store_image" /></td>
					</tr>
						<tr>
						<td class="txt-blck">Store Banner:</td>
						<td><input type="file" id="store_banner" name="store_banner" /></td>
					</tr>
						<tr>
							<td class="txt-blck">Store Status:</td>
							<td><select id="store_status" name="store_status">
									<option value="Yes">Yes</option>
									<option value="No">No</option>
							</select></td>
						</tr>
						<tr>
							<td class="txt-blck">Store Type:</td>
							<td><select id="store_type" name="store_type">
									<option value="Promo">Promo</option>
									<option value="Money">Money</option>
							</select></td>
						</tr>
						<tr>
							<td valign="top" class="txt-blck">Store Description:</td>
							<td><textarea style="width: 450px; height: 300px;" class="input"
									id="store_description" name="store_description"></textarea></td>
						</tr>
						<tr>
							<td valign="top" class="txt-blck">Store Affliate URL:</td>
							<td>
								<div><input type="text" class="inputCMS" name="store_affilateurl" id="store_affilateurl" style="width:300px" value="" /></div>						
							</td>
						</tr>
						
						<tr>
							<td class="txt-blck">Store Redirect:</td>
							<td><select id="store_redirecturl" name="store_redirecturl">
									<option value="trootrac">Trootrac</option>
									<option value="tyroo">Tyroo</option>
									<option value="omg">OMG</option>
							</select></td>
						</tr>

						<tr>
							<td valign="top" class="txt-blck">Store UTM Source:</td>
							<td>
								<div><input type="text" class="inputCMS" name="store_utmsource" id="store_utmsource" style="width:300px" value="" /></div>						
							</td>
						</tr>
						
						<tr>
							<td class="txt-blck" width="30%">Store Metatitle:</td>
							<td width="70%"><input type="text" class="inputCMS" value="" name="metatitle"
								id="metatitle" class="input" style="width: 300px;" />
							</td>
						</tr>
						<tr>
							<td class="txt-blck" width="30%">Store Meta Keyword:</td>
							<td width="70%"><input type="text" value="" name="metakeyword"
								id="metakeyword" class="inputCMS" style="width: 300px;" />
							</td>
						</tr>
						<tr>
							<td valign="top" class="txt-blck">Store Meta Description:</td>
							<td><input type="text" value="" name="metadescription"
								id="metadescription" class="inputCMS" style="width: 300px;" /></td>
						</tr>
						<tr>
							<td></td>
							<td><input type="submit" name="store_submit" value="Submit" /></td>
						</tr>
					</table>
				</form></td>
		</tr>
	</table>
</div>
</div>
</article>
<div class="clr-both spacer-10">&nbsp;</div>
<?php $this->load->view('common/ck-bossfooter'); ?>
<script>
function makeURLStore(obj){
	var str = obj.value;
	str1 = str.toLowerCase();
	str2 = str1.replace(/ /g,"-");
	document.getElementById('store_url').value = str2;
    document.getElementById('metatitle').value = str+" Coupons - "+str+" Discount Coupons at Couponskart.net";
    document.getElementById('metakeyword').value = str+", "+str+".com, "+str+" coupons, "+str+" coupon codes, "+str+" discount coupons, "+str+" Promotion codes, discount codes, voucher code, deals, promo codes, offers.";
    document.getElementById('metadescription').value = str+" Coupons - Shop for Shoes, Clothing, Home and Kitchen, Bags  and Accessories by using "+str+" Discount Coupons at CouponsKart.net";
}

function validateForm(){
	var x = document.getElementById('store_name').value;
	if(x==""){
	alert("Store Name must be filled out.");
	return false;
	}
	var y = document.getElementById('store_affilateurl').value;
	if(y==""){
	alert("Store Affilate Url must be filled out.");
	return false;
	}
}
</script>